package com.nacos.novelbookapi.controller;

import com.nacos.novelbookapi.service.NovelBookService;
import com.nacos.novelcommon.entity.NovelBook;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (NovelBook)表控制层
 *
 * @author 刘会发
 * @since 2020-04-01 21:30:38
 */
@RestController
@RequestMapping("novelBook")
public class NovelBookController {
    /**
     * 服务对象
     */
    @Resource
    private NovelBookService novelBookService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public NovelBook selectOne(Integer id) {
        return this.novelBookService.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param book
     * @return
     */
    @PostMapping(value = "insert")
    public NovelBook insert(NovelBook book) {
        return this.novelBookService.insert(book);
    }


}